package ljy.day2;
import java.util.Scanner;
public class code {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入一个12位数的数字");

        String s = sc.next();


        if (s.length() != 12){

            System.out.println("你输入的长度不对,请重新输入！");

            return;

        }



        int c1=0;//奇数位的和

        int c2=0;//偶数位的和



        for (int i=0; i < s.length(); i+=2){



            char c = s.charAt(i);


            c1 = c1+c-48;



            char c3 = s.charAt(i+1);


            c2 = c2+c3-48;

        }



        int cc = c1+c2*3;


        cc %= 10;



        cc=10-cc;

        cc=cc%10;

        System.out.println("第13位验证码为"+ s + cc);

    }


    }

